/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.risk.hid.mapper;

import com.hopes.bizz.risk.hid.bo.RiskHidHiddenDangerBO;
import com.hopes.bizz.risk.hid.entity.RiskHidHiddenDangerEntity;
import com.hopes.bizz.risk.parkgis.vo.OrgHidVO;
import com.hopes.boss.common.data.datascope.BossBaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 隐患信息
 *
 * @author pig
 * @date 2023-07-18 10:51:29
 */
@Mapper
public interface RiskHidHiddenDangerMapper extends BossBaseMapper<RiskHidHiddenDangerEntity> {

    List<Integer> getSafetyHidData(RiskHidHiddenDangerBO danger);

    RiskHidHiddenDangerEntity getOneByRiskHid(String code);

    /**
     * 根据企业统计数量
     * @return 统计结果
     */
    @MapKey("orgId")
    Map<Long, Long> countGroupByCompany();

    /**
     * 根据企业、隐患等级统计结果
     * @param startTime    开始时间
     * @return             结果
     */
    List<OrgHidVO> listGroupLevelCompany(@Param("startTime") Date startTime);

    @Select("select * from risk_hid_hidden_danger where uid = #{uid}")
    RiskHidHiddenDangerEntity getByUid(String uid);
}
